import re
from enum import Enum
from sqlalchemy import Column, Integer, String, DateTime, Text, Float, func, SmallInteger, UniqueConstraint, \
    Enum as SqlEnum, ForeignKey, Table, Date
from sqlalchemy.dialects.mysql import TINYINT, INTEGER
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import validates, relationship
from model.params import RoleNameEnum


Base = declarative_base()

class TbLicense(Base):
    __table_args__ = {
        'schema': 'reservoir'
    }
    __tablename__ = 'tb_license'
    __table_args__ = {'comment': '授权信息表'}

    LegalPerson_ID = Column(INTEGER(11), primary_key=True, comment='法人ID')
    LegalPeson_Name = Column(String(50), comment='法人名称')
    LegalPeson_Code = Column(String(20), comment='机构代码')
    LegalPeson_Representative = Column(String(10), comment='法人代表')
    Auth_serial_number = Column(String(100), comment='授权序列号')
    IsQualified = Column(TINYINT(4), comment='授权状态')
    Authed_StartDate = Column(Date, comment='授权日期')
    Authed_EndDate = Column(Date, comment='授权截止日期')
    Authed_Online_Number = Column(INTEGER(11), comment='限定在线数')
    User_DB_constr = Column(String(200), comment='用户库连接串')
    Auth_devname = Column(String(10), comment='授权人')
    License_Remarks = Column(String(100), comment='授权说明')